package com.yanqu.road.server.cmd.activity.langyabang.fromCross;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.LangYaBangProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.activity.langyabang.LangYaBangModule;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.GameProtocol;

@Cmd(code = GameProtocol.S_LANG_YA_PVP_RESULT_FORM_CROSS,desc = "pvp返回本服")
public class LangYaPvpResultFromCrossCmd extends AbstractCommand {
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        LangYaBangProto.DoPvpEventRespMsg langYaRollDiceRespMsg = LangYaBangProto.DoPvpEventRespMsg.parseFrom(packet.getBytes());
        if (langYaRollDiceRespMsg.getRet() != 0){
            player.sendPacket(ClientProtocol.U_LANG_YA_BANG_PVP,langYaRollDiceRespMsg.toBuilder());
            return;
        }
        player.getModule(LangYaBangModule.class).dealPvpResult(langYaRollDiceRespMsg);
    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
